package com.ruoyi.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.Article;
import com.ruoyi.system.domain.Tags;
import com.ruoyi.system.mapper.ArticleMapper;
import com.ruoyi.system.service.IArticleService;

/**
 * 文章查询Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-14
 */
@Service
public class ArticleServiceImpl implements IArticleService 
{
    @Autowired
    private ArticleMapper articleMapper;

    /**
     * 查询文章查询
     * 
     * @param articleId 文章查询主键
     * @return 文章查询
     */
    @Override
    public Article selectArticleByArticleId(Integer articleId)
    {
        return articleMapper.selectArticleByArticleId(articleId);
    }

    /**
     * 查询文章查询列表
     * 
     * @param article 文章查询
     * @return 文章查询
     */
    @Override
    public List<Article> selectArticleList(Article article)
    {
        return articleMapper.selectArticleList(article);
    }

    /**
     * 新增文章查询
     * 
     * @param article 文章查询
     * @return 结果
     */
    @Override
    public int insertArticle(Article article)
    {
        article.setCreateTime(DateUtils.getNowDate());
        articleMapper.insertArticle(article);
        return article.getArticleId();
    }

    /**
     * 修改文章查询
     * 
     * @param article 文章查询
     * @return 结果
     */
    @Override
    public int updateArticle(Article article)
    {
        return articleMapper.updateArticle(article);
    }

    /**
     * 批量删除文章查询
     * 
     * @param articleIds 需要删除的文章查询主键
     * @return 结果
     */
    @Override
    public int deleteArticleByArticleIds(Integer[] articleIds)
    {
        return articleMapper.deleteArticleByArticleIds(articleIds);
    }

    /**
     * 删除文章查询信息
     * 
     * @param articleId 文章查询主键
     * @return 结果
     */
    @Override
    public int deleteArticleByArticleId(Integer articleId)
    {
        return articleMapper.deleteArticleByArticleId(articleId);
    }
    /**
     * 查询热门文章
     * 
     * @param article 文章查询
     * @return 文章查询集合
     */
	@Override
	public List<Article> selectArticleListrm(Article article) {
		return articleMapper.selectArticleListrm(article);
	}

	@Override
	public List<Article> selectArticleListde(Article article) {
		return articleMapper.selectArticleListde(article);
	}
	/**
     * 根据标签查询文章
     * 
     * @param article 文章查询
     * @return 文章查询集合
     */
	@Override
	public List<Article> selectArticleListByTag(Tags tags) {
		return articleMapper.selectArticleListByTag(tags);
	}
}
